import request from '@/utils/request'

export function loadDataUrl() {
  return 'report-service/api/reportMng/loadData'
}

export function findReportByCpyCodeUrl() {
  return 'report-service/api/reportMng/findReportByCpyCode'
}

export function previewReportDataUrl() {
  return 'report-service/api/reportMng/previewReportData'
}

export function deleteUrl() {
  return 'report-service/api/reportMng/doDelete'
}

export function submitUrl() {
  return 'report-service/api/reportMng/doSubmit'
}

export function exportUrl() {
  return 'report-service/api/reportMng/doExport'
}

export function doParseSql(data) {
  return request({
    url: 'report-service/api/reportMng/doParseSql',
    method: 'post',
    data
  })
}

export function doRefreshMapper() {
  return request({
    url: 'report-service/api/reportMng/doRefreshMapper',
    method: 'post'
  })
}

export function doRefreshPriv() {
  return request({
    url: 'report-service/api/reportMng/doRefreshPriv',
    method: 'post'
  })
}

export function toAdd(data) {
  return request({
    url: 'report-service/api/reportMng/toAdd',
    method: 'post',
    data
  })
}

export function toCopy(data) {
  return request({
    url: 'report-service/api/reportMng/toCopy',
    method: 'post',
    data
  })
}

export function toChange(data) {
  return request({
    url: 'report-service/api/reportMng/toChange',
    method: 'post',
    data
  })
}

export function viewMainData(data) {
  return request({
    url: 'report-service/api/reportMng/toView',
    method: 'post',
    data
  })
}

export function addOrEdit(data) {
  return request({
    url: 'report-service/api/reportMng/doSave',
    method: 'post',
    data
  })
}

export function del(data) {
  return request({
    url: 'report-service/api/reportMng/doDelete',
    method: 'post',
    data
  })
}

export function getReportParamList(mainId) {
  return request({
    url: 'report-service/api/reportMng/getReportParamList',
    method: 'get',
    params: {
      mainId
    }
  })
}

export function getReportFieldList(mainId) {
  return request({
    url: 'report-service/api/reportMng/getReportFieldList',
    method: 'get',
    params: {
      mainId
    }
  })
}

export function getReportDefine(reportCode, reportId, hrefParam) {
  return request({
    url: 'report-service/api/reportMng/getReportDefine',
    method: 'get',
    params: {
      reportCode,
      reportId,
      hrefParam
    }
  })
}

export function getReportLanByReportId(reportId) {
  return request({
    url: 'report-service/api/reportMng/getReportLanByReportId',
    method: 'get',
    params: {
      reportId
    }
  })
}
